package com.yutel.tool;

import com.yutel.tool.apk.ApkCmd;
import com.yutel.tool.web.WebCmd;
import com.yutel.tool.zip.ZipCmd;

public class Main {

	public static void main(String[] args) {
		try {
			if (args.length > 0) {
				if (args[0].equals(ZipCmd.TYPE_ZIP)) {
					ZipCmd.command(args);
				} else if (args[0].equals(ZipCmd.TYPE_UNZIP)) {
					ZipCmd.command(args);
				} else if (args[0].equals(ApkCmd.TYPE_APK)) {
					ApkCmd.command(args);
				} else if (args[0].equals(ApkCmd.TYPE_INFO)) {
					ApkCmd.command(args);
				} else if (args[0].equals(ApkCmd.TYPE_MD5)) {
					ApkCmd.command(args);
				} else if (args[0].equals(WebCmd.TYPE_WEB)) {
					WebCmd.command(args);
				} else {
					System.out.println(args[0] + " is not support command");
				}
			} else {
				System.out.println(help());
			}
		} catch (Exception e) {
			StringBuffer sb = new StringBuffer();
			sb.append("parameter:");
			for (String i : args) {
				sb.append(i).append(" ");
			}
			System.err.println(sb.toString());
			e.printStackTrace();
		}
	}

	private static String help() {
		StringBuffer sb = new StringBuffer();
		sb.append("Usage:").append("\n");
		sb.append(ZipCmd.help());
		sb.append(ApkCmd.help());
		sb.append(WebCmd.help());
		return sb.toString();
	}

}
